﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace QuanLyThuNgan
{
    public class GiaPhauThuatDAO
    {
        public bool m_Insert(GiaPhauThuatDTO _info)
        {
            int istop = 0;
            if (_info.Bstopsd == true)
                istop = 1;
            string _sql = string.Format("usp_ThuNgan_GiaPhauThuat_Insert '{0}',N'{1}',{2},{3},{4},{5},'{6}',N'{7}',{8}", _info.SMaLoaiPT, _info.Schidanh, _info.Idongia, _info.Igiabhyt, istop, _info.Iidphanloaipt, _info.Smabhyt, _info.STenGiaPT, _info.IIDPhanLoaiPTBHYT);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }

        public bool m_Update(GiaPhauThuatDTO _info)
        {
            int istop = 0;
            if (_info.Bstopsd == true)
                istop = 1;
            string _sql = string.Format("usp_ThuNgan_GiaPhauThuat_Update '{0}',N'{1}',{2},{3},{4},{5},'{6}',N'{7}',{8}", _info.Smaso, _info.Schidanh, _info.Idongia, _info.Igiabhyt, istop, _info.Iidphanloaipt, _info.Smabhyt, _info.STenGiaPT, _info.IIDPhanLoaiPTBHYT);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }

        public bool m_Delete(GiaPhauThuatDTO _info)
        {
            string _sql = string.Format("usp_ThuNgan_GiaPhauThuat_Delete {0}", _info.Smaso);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }

        public DataTable m_SelectAllGiaPhauThuat()
        {
            string _sql = string.Format("usp_ThuNgan_GiaPT_SelectAll ");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }

        public DataTable m_SelectTenPhanLoaiPT()
        {
            string _sql = string.Format("usp_ThuNgan_PhanLoaiPT_SelectTen ");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }

        public DataTable m_SelectTenPhanLoaiPTBHYT()
        {
            string _sql = string.Format("usp_ThuNgan_PhanLoaiPTBHYT_SelectTen ");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }
        
        //load loai pt----------------------------------------------------
        public DataTable m_SelectTenLoaiPT()
        {
            string _sql = string.Format("usp_ThuNgan_LoaiPT_SelectTenLoaiPT");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }

    }
}
